#!/bin/bash
DB_USER="user"
DB_PASS="pass"
BACKUP_DIR="/backup"
mysqldump -u$DB_USER -p$DB_PASS --all-databases | gzip > $BACKUP_DIR/db_$(date +%F).sql.gz
find $BACKUP_DIR -name "*.sql.gz" -mtime +30 -delete